<?php

$this->breadcrumbs=array(
	'Categories'=>array('index'),
);


//foreach ($model->path as $c)
//	$this->breadcrumbs[$c->name] = array('view', 'id'=>$c->id);

$this->breadcrumbs[] = $model->name;

$this->menu=array(
	array('label'=>'Update Category', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete Category', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage Category', 'url'=>array('index')),
);

if ($model->id) array_unshift($this->menu, array('label'=>'Create SubCategory', 'url'	=>	array('create', 'pid'	=>	$model->id)));
else array_unshift($this->menu, array('label'=>'Create Category', 'url'=>array('create')));
?>

<h1 style="display: inline; margin-bottom: 5px;">Category "<em><?php echo $model->name; ?>"</em></h1>

<?php
$path = '';

$p = $model;
while (!empty($p)) {
	$path = ' &raquo; ' . CHtml::link($p->name, $this->createUrl('view', array('id'=>$p->id))) . $path;
	$p = $p->parent;
}
$path = 'Root' . $path;

$this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		array(
			'name'	=>	'name',
			'type'	=>	'raw',
		),
		array(
			'label'	=>	'Path',
			'value'	=>	$path,
			'type'	=>	'raw',
		),
		array(
			'name'	=>	'url_key',
			'type'	=>	'raw',
		),
		'enable',
	),
)); ?>

<?php if (!$model->is_leaf): ?>
	<h2>Children categories</h2>
	<?php echo $this->renderPartial('_children', array(
		'model'=>$model,
	));
	endif;
	?>

   <?php if (!empty($model->articles)): ?>
	<h2>news in category "<?php echo $model->name; ?>"</h2>
	<?php echo $this->renderPartial('_articles', array(
		'model'=>$model,
	));
	endif;
	?>


